/*
 * @Author: 郑刘利
 * @Date: 2020-03-18 14:20:31
 * @LastEditors: 郑刘利
 * @LastEditTime: 2020-03-18 15:50:29
 * @Description: file content
 */
import { IUser } from '../user/User';

type MessageUser = Omit<IUser, 'describe'>;
export enum MessageType {
    'photo' = 1
}
export interface IMessage {
    id: string;
    to: MessageUser;
    from: MessageUser;
    type: MessageType;
}
export class Message<T = any> implements IMessage {
    public id: string;
    public to: MessageUser;
    public from: MessageUser;
    public type: MessageType;
    public payload: T;
    public constructor(base: IMessage, payload: T) {
        this.id = base.id;
        this.to = base.to;
        this.from = base.from;
        this.type = base.type;
        this.payload = payload;
    }
}

export interface PhotoPayload {
    url: string;
}

export interface TextPayload {
    text: string;
}
